//
// Created by user on 2022/2/21.
//
#include <unordered_set>
using namespace std;
int numJewelsInStones(string jewels, string stones) {
    unordered_set<char> set;
    for (char c: jewels){
        set.insert(c);
    }
    int ans = 0;
    for (char c:stones){
        if(set.count(c)){ans++;}
    }
    return ans;
}

int numJewelsInStones1(string jewels, string stones) {
    int len = 'z' - 'A'+1;
    vector<int> count(len);

    for (int i = 0; i < jewels.length(); ++i) {
        count[jewels[i]-'A'] = 1;
    }
    int ans = 0;
    for (char c : stones) {
        if (count[c - 'A'] == 1) ans++;
    }

    return ans;


}